using System;
using System.ComponentModel;
using DominionCS.Views;

using Microsoft.Practices.Composite.Presentation.Commands;

namespace DominionCS.ViewModels
{
    public class ShellViewModel : INotifyPropertyChanged
    {
        public ShellViewModel()
        {
            // Initialize this ViewModel's commands.
            ExitCommand  = new DelegateCommand<object>(AppExit,  CanAppExit);
            AboutCommand = new DelegateCommand<object>(AppAbout, CanAppAbout);
        }

    #region ExitCommand
        public DelegateCommand<object> ExitCommand {get; private set;}

        private void AppExit(object commandArg)
        {
            App.Current.Shutdown();
        }

        private bool CanAppExit(object commandArg)
        {
            return true;
        }
    #endregion

    #region AboutCommand
        public DelegateCommand<object> AboutCommand {get; private set;}
        private void AppAbout(object nuthin)
        {
            AboutView About = new AboutView(new AboutViewModel());
            About.ShowDialog();
        }
        private bool CanAppAbout(object nuthin) {return true;}
    #endregion

    #region INotifyPropertyChanged Members
        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    #endregion
    }
}
